package util;

import java.io.IOException;
import java.io.InputStream;

public class restartRunable implements Runnable {
    @Override
    public void run() {

    }

    public void runbat(String batName) {
        String cmd = System.getProperty("user.dir") + "\\pack.bat";// pass
        try {
            Process ps = Runtime.getRuntime().exec(cmd);
            InputStream in = ps.getInputStream();
            int c;
            while ((c = in.read()) != -1) {
//                System.out.print(c);// 如果你不需要看输出，这行可以注销掉
            }
            in.close();
            ps.waitFor();
        } catch (IOException ioe) {
            ioe.printStackTrace();
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        System.out.println("child thread donn");
    }

    public static void main(String[] args) {
        System.out.println("main thread");
        String sysPath = System.getProperty("user.dir");
        System.out.println(sysPath);
        restartRunable test1 = new restartRunable();
        test1.runbat("news");

    }
}
